home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 1 / Gold Medal Software Volume 1 (Gold Medal) (1994).iso / prog / dasv10_.arj / TWODICE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-13  |  687 b   |  25 lines

  1. // dice.lib function two_dice()
  2. #include <dos.h>
  3. #include <iostream.h>
  4. #include <stdlib.h>
  5.  
  6. int two_dice(int size,int time,int disp1,int disp2,char string3[30])
  7. {
  8.     int dice1,dice2,sumdice,j;
  9.  
  10.     for (j=1;j<=10;j++) {
  11.     dice1 = 1 + rand() % size;
  12.     dice2 = 1 + rand() % size;
  13.     sumdice=dice1+dice2;
  14.     if (disp1 == 0 && disp2 == 0)
  15.         cout<<string3<<"?? + ?? = ??   \r";
  16.     else if (disp1 == 0 && disp2 == 1)
  17.         cout<<string3<<"?? + ?? = "<<sumdice<<"   \r";
  18.     if (disp1 == 1 && disp2 == 0)
  19.         cout<<string3<<dice1<<" + "<<dice2<<" = ??   \r";
  20.     else if (disp1 == 1 && disp2 == 1)
  21.         cout<<string3<<dice1<<" + "<<dice2<<" = "<<sumdice<<"   \r";
  22.     delay(time);
  23.     }
  24. return sumdice;
  25. }